﻿using umbraco.cms.businesslogic;

namespace ClientTools.Library.DataTypes.Umbraco
{
    public class Node
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string NodeTypeAlias { get; set; }
        public int NodeTypeId { get; set; }
        public NodeCollection Children { get; set; }
        public bool HasChildren { get; set; }
        public PropertyCollection Properties { get; set; }
        //public int VersionCount { get; set; }
        //public int ChildrenVersionCount { get; set; }

        public bool ChildrenLoaded
        {
            get { return !HasChildren || !(Children.Count == 0); }
        }

        public Node()
        {
            Children = new NodeCollection();
            HasChildren = false;
            Properties = new PropertyCollection();
        }

        //public Node(Content umbracoMedia)
        //{
        //    Id = umbracoMedia.Id;
        //    Name = umbracoMedia.Text;
        //    NodeTypeId = umbracoMedia.ContentType.Id;
        //    NodeTypeAlias = umbracoMedia.ContentType.Text;

        //    foreach (var umbracoProperty in umbracoMedia.getProperties)
        //        Properties.Add(new Property(umbracoProperty));
        //}
    }
}